CHARTS

Lone-parent Households

Bar Vertical Segmented

Photo by Marcelo Silva on Unsplash

Photo by Marcelo Silva on Unsplash

Being a single parent is twice the work, but also twice the hugs…
— Unknown


Load the data

Lone-parent households by age and sex of parent, age of child and region, latest available year

# Load data
url_root <- "https://raw.githubusercontent.com/UN-AVT/kamino-source/main/sources/0-shared/data/"
url_file <- "lone-parent-households/figure-2-11.csv"
url <- paste0(url_root, url_file)

df <- read_csv(url, col_names=TRUE)
df

Wrangle

Transpose, format and order

# Transpose columns
long <- gather(df, type, Percentage, "Lone father (all ages)":"Lone mother 60+ and all children 18 and over", factor_key=FALSE)

# Format x-axis labels
long$Regionwrap = str_wrap(long$Region, width = 17)

# Order by category
long$type <- factor(long$type, levels=c("Lone mother 0-17 and at least one child below 18",
                                        "Lone mother 18-24 and at least one child below 18",
                                        "Lone mother 25-34 and at least one child below 18",
                                        "Lone mother 35-59 and at least one child below 18",
                                        "Lone mother 60+ and at least one child below 18",
                                        "Lone mother 25-34 and all children 18 and over",
                                        "Lone mother 35-59 and all children 18 and over",
                                        "Lone mother 60+ and all children 18 and over",
                                        "Lone father (all ages)"))

long

Plot the chart

One-parent households: mostly lone mothers - Figure 2.11

# Define palette
segment_palette <- c("Lone mother 0-17 and at least one child below 18" = "#6b9e7e",
                "Lone mother 18-24 and at least one child below 18" = "#88b88a",
                "Lone mother 25-34 and at least one child below 18" = "#a6609c",
                "Lone mother 35-59 and at least one child below 18" = "#692c7d",
                "Lone mother 60+ and at least one child below 18" = "#acc8ed",
                "Lone mother 25-34 and all children 18 and over" = "#678bb3",
                "Lone mother 35-59 and all children 18 and over" = "#406993",
                "Lone mother 60+ and all children 18 and over" = "#bec068",
                "Lone father (all ages)" = "#2b4662")

# Make the plot
v1<-ggplot(long, aes(y = Percentage, x = Regionwrap)) + 
  geom_col(aes(fill = type), position = "fill", width = 0.55) +
  scale_y_continuous(labels = percent_format(accuracy=1), breaks=seq(0,1,0.1)) +
  scale_fill_manual(values = segment_palette) +
  scale_x_discrete(limits=c("Sub-Saharan\nAfrica",
                            "Central and\nSouthern Asia",
                            "Northern Africa\nand Western Asia",
                            "Latin America and\nthe Caribbean",
                            "Europe and\nNorthern America",
                            "World")) +
  labs(
    title = "Figure 2.11: Lone-parent households by age and sex of parent, age of child and region, latest available year",
    caption = "Source: UN Women Progress of the World's Women 2019-2020 - Families in a Changing World") +
  theme( panel.background = element_rect(fill = "white"), 
         panel.grid.major.y = element_line(color="gray", size=0.1), 
         axis.title.x = element_blank(), 
         axis.ticks = element_blank(), 
         legend.position = "bottom", 
         legend.title = element_blank()) +
  guides(fill = guide_legend(ncol=2)) +
  geom_text(aes(fill = type, label = Percentage), position = position_fill(vjust = 0.5), check_overlap = TRUE, color="white", size = 3)
 
girafe(ggobj = v1, width_svg = 16, height_svg = 12,
       options = list(opts_sizing(rescale = TRUE, width = 1.0)))

References

citations for narrative and data sources

  • Narrative and Data sources: UN Women Progress of the world’s women 2019-2020 Report, GO